<template>
  <el-row class="tac">
    <el-col :span="24">
      <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          router="true"
          @open="handleOpen"
          @close="handleClose"
      >
        <el-menu-item index="1" :route="{name:'first'}">
          <el-icon><icon-menu /></el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-sub-menu index="2">
          <template #title>
            <el-icon><location /></el-icon>
            <span>菜单</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="1-1" :route="{name:'generator'}">代码生成设计</el-menu-item>
            <el-menu-item index="1-2" >代码规范</el-menu-item>
          </el-menu-item-group>
          <el-sub-menu index="1-3">
            <template #title>代码模板</template>
            <el-menu-item index="1-4-1">controller</el-menu-item>
            <el-menu-item index="1-4-1">dao</el-menu-item>
            <el-menu-item index="1-4-1">service</el-menu-item>
            <el-menu-item index="1-4-1">serviceImpl</el-menu-item>
            <el-menu-item index="1-4-1">entity</el-menu-item>
            <el-menu-item index="1-4-1">xml</el-menu-item>
          </el-sub-menu>
        </el-sub-menu>
        <el-menu-item index="3" :route="{name:'table'}">
          <el-icon><MagicStick /></el-icon>
          <span>代码生成器</span>
        </el-menu-item>
        <el-menu-item index="4">
          <el-icon><setting /></el-icon>
          <span>设置</span>
        </el-menu-item>
      </el-menu>
    </el-col>
  </el-row>
</template>

<script lang="ts" setup>
import {
  MagicStick,
  Menu as IconMenu,
  Location,
  Setting,
} from '@element-plus/icons-vue'
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
</script>
